/**
 * 
 */
package com.saceem.ui.beans;

import javax.annotation.PostConstruct;
import javax.ejb.PostActivate;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.bean.SessionScoped;
import javax.faces.context.FacesContext;

import org.apache.log4j.Logger;

import com.saceem.beans.Imagenes;

/**
 * @author Nicolas Bordenave
 * @date 17/01/2012
 * @version 1.0
 */

@ManagedBean
@SessionScoped
public class FacturaBean {

	private static final Logger log = Logger.getLogger(FacturaBean.class
			.getName());

	// @ManagedProperty(value="#{param.id}")
	// private Long id;

	private Imagenes img;

	@ManagedProperty(value = "#{param.id}")
	private String codigo;
	
	@ManagedProperty(value = "#{param.factura}")
	private String img64;

	public FacturaBean() {
		super();
	}

	/**
	 * @return the img
	 */
	public Imagenes getImg() {
		return img;
	}

	/**
	 * @param img
	 *            the img to set
	 */
	public void setImg(Imagenes img) {
		this.img = img;
	}

	/**
	 * @return the img64
	 */
	public String getImg64() {
		return img64;
	}

	/**
	 * @param img64
	 *            the img64 to set
	 */
	public void setImg64(String img64) {
		this.img64 = img64;
	}

	/**
	 * @return the codigo
	 */
	public String getCodigo() {
		return codigo;
	}

	/**
	 * @param codigo
	 *            the codigo to set
	 */
	public void setCodigo(String codigo) {
		this.codigo = codigo;
	}

	// @PostActivate
	// private void test() {
	//
	// String codigo = FacesContext.getCurrentInstance().getExternalContext()
	// .getRequestParameterMap().get("codigo");
	// log.info("Codigo obtenido : " + codigo);
	// setCodigo(codigo);
	//
	// }

	@PostConstruct
	public void init() {
		log.info("Codigo obtenido : " + codigo);
		System.out.println(codigo); // 9099 as in your example.
	}

}
